package org.come.shortcut;

import com.tool.btn.FormsOnOffBtn;
import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;
import com.tool.tcp.Sprite;
import com.tool.tcp.SpriteFactory;
import com.tool.tcpimg.RichLabel;
import com.tool.tcpimg.UIUtils;
import org.come.bean.ConfigureBean;
import org.come.entity.Baby;
import org.come.entity.Goodstable;
import org.come.model.Configure;
import org.come.mouslisten.BabyTalentMouslisten;
import org.come.mouslisten.WLLMouslisten;
import org.come.summonequip.BtnSummonEquipMain;
import org.come.tt.LadderBoxOpenMouslisten;
import org.come.tt.LadderPanelBtn;
import org.come.until.CutButtonImage;
import org.come.until.SrcollPanelUI;
import org.come.until.UserMessUntil;

import javax.swing.*;
import java.awt.*;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Map;

 

public class XBjczJpanelsdl extends JPanel {

    private JLabel  labtext,labtext1,labtext2;//

    private static FormsOnOffBtn palBtn,protectBtn,
            dytBtn,dgBtn,CHA,chuan,
            xfBtn,huanj,slBtn,cashRewards,arenaBtn,cashRewardsBtn,yzBtn,
            TJBtn1,zhuanshen,dnBtn,
            CBGBtn,ttBtn,lsBtn,fuzhu,
            zaBtn,RanklistBtn,byBtn,
            ypBtn,gangBtn,friendsBtn,
            taskBtn,petBtn,childBtn,
            knapsackBtn,QianDaoMenu,GMshop,TtBtn,bjczBtn
            ,spBtn,ksBtn,bpBtn;


    private Goodstable good;
    private static String[] Fvalue;
    private static JTextArea testMes;// 用来显示聊天信息
    public String npczb;
    public static String npcfeiji;
    private JScrollPane jscPanel;
    private RichLabel richText;
    private JScrollPane jscPanel1;
    private RichLabel richText1;
    //新增加tcp
    static Sprite tcp = SpriteFactory.VloadSprite("resource/FightingSkill/持续状态/tx1.tcp", null);//特效路径
    static Sprite tcp2 = SpriteFactory.VloadSprite("resource/FightingSkill/持续状态/tx1.tcp", null);//特效路径
    static Sprite tcp3 = SpriteFactory.VloadSprite("resource/FightingSkill/持续状态/tx1.tcp", null);//特效路径
    static Sprite tcp4 = SpriteFactory.VloadSprite("resource/FightingSkill/持续状态/tx1.tcp", null);//特效路径

    private ImageIcon icon = null;
    static {
        if (tcp == null) {
            tcp = tcp;

        }
    }
    static {
        if (tcp2 == null) {
            tcp2 = tcp2;

        }
    }
    static {
        if (tcp3 == null) {
            tcp3 = tcp3;

        }
    }
    static {
        if (tcp4 == null) {
            tcp4 = tcp4;

        }
    }
    public XBjczJpanelsdl() {
        this.setPreferredSize(new Dimension(538, 366));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);
        getJscPanel();
        getJscPanel1();
//            // 乳名
//            labPetname = new JLabel();
//            labPetname.setBounds(56, 10, 167, 18);
//            labPetname.setForeground(Color.WHITE);
//            labPetname.setFont(new Font("微软雅黑", 0, 13));
//            this.add(labPetname);
//            // 气质
//            labtemperament = new JLabel();
//            labtemperament.setBounds(56, 31, 58, 18);
//            labtemperament.setForeground(Color.WHITE);
//            labtemperament.setFont(new Font("宋体", 1, 14));
//            this.add(labtemperament);
//
//          btnfollow = new XBjczBtn(imageMap.getImgMap().get("B20"),"B20", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "跟随");
//           btnfollow.setBounds(53, 181, 59, 24);
//          this.add(btnfollow);
//            btnStandby = new XBjczBtn(imageMap.getImgMap().get("B20"),"B20", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "参战");
//            btnStandby.setBounds(130, 181,59, 24);
//            this.add(btnStandby);

        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));
        int szz = 5;//3种族
        if(configure.getLzjskg()!=null) {
            szz = Integer.parseInt(configure.getLzjskg());
        }


            /**-----------------------------------------商店类---------------------------------------*/


        //比斗
        cashRewards = new FormsOnOffBtn("skin/8100226/newbutton/B37.png", 1, UIUtils.COLOR_BTNTEXT, "", 3103);
        cashRewards.setBounds(152, 279, 60, 60);//x+95,y+45
        this.add(cashRewards);


        //比斗奖章
        cashRewardsBtn = new FormsOnOffBtn("skin/8100226/newbutton/B36.png", 1, UIUtils.COLOR_BTNTEXT, "", 920);
        cashRewardsBtn.setBounds(152+100, 279, 60, 60);//x+95,y+45
        this.add(cashRewardsBtn);


        //竞技按钮 移动快捷菜单
        arenaBtn = new FormsOnOffBtn("skin/8100226/newbutton/B37.png", 1, UIUtils.COLOR_BTNTEXT, "", 5);
        arenaBtn.setBounds(423, 279, 60, 60);
        this.add(arenaBtn);



        //勇者兑换
        yzBtn = new FormsOnOffBtn("skin/8100226/newbutton/B36.png", 1, UIUtils.COLOR_BTNTEXT, "", 92);
        yzBtn.setBounds(423+100, 279, 60, 60);//x+95,y+45
        this.add(yzBtn);


    }




//    ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if (icon == null) {
            icon = new ImageIcon("inkImg/newbackground/B302.png");
        }
        g.drawImage(icon.getImage(), 76, 20, 532, 360, this);

        g.setColor(UIUtils.COLOR_HURTB4);
        g.setFont(UIUtils.TEXT_FONT63);
        g.drawString("比斗奖章:" + RoleData.getRoleData().getLoginResult().getScoretype("比斗奖章"), 80, 370);

        g.setColor(UIUtils.COLOR_HURTB5);
        g.setFont(UIUtils.TEXT_FONT63);
        g.drawString("勇者积分:" + RoleData.getRoleData().getLoginResult().getScoretype("勇者积分"), 352, 370);

    }



    public static int getCurrentMonthDay() {
        Calendar a = Calendar.getInstance();

        a.set(Calendar.DATE, 1);

        a.roll(Calendar.DATE, -1);

        int maxDate = a.get(Calendar.DATE);

        return maxDate;

    }


    public Goodstable getGood() {
        return good;
    }

    public void setGood(Goodstable good) {
        this.good = good;
    }

    public String[] getFvalue() {
        return Fvalue;
    }

    public void setFvalue(String[] fvalue) {
        Fvalue = fvalue;
    }

    public JTextArea getTestMes() {
        return testMes;
    }

    public void setTestMes(JTextArea testMes) {
        XBjczJpanelsdl.testMes = testMes;
    }


    public JScrollPane getJscPanel() {
        if (jscPanel == null) {
            // 属性滚动条
            jscPanel = new JScrollPane(getRichText());
            jscPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            jscPanel.getVerticalScrollBar().setUI(new SrcollPanelUI());
            jscPanel.getVerticalScrollBar().setUnitIncrement(20);
            jscPanel.getViewport().setOpaque(false);
            jscPanel.setOpaque(false);
            jscPanel.setBounds(155, 61, 176, 189);
            jscPanel.setBorder(BorderFactory.createEmptyBorder());
            jscPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(jscPanel);
        }

        return jscPanel;


    }

    public void setJscPanel(JScrollPane jscPanel) {
        this.jscPanel = jscPanel;
    }

    public RichLabel getRichText() {
        if(richText == null){
            richText = new RichLabel();
            richText.setText("桃源仙境:每日可挑战一次#r #r1,挑战形式为人物观战模式,仅召唤兽与敌方召唤兽战斗#r #r2,战斗成功后立刻进行下一轮无间隔战斗,直至战斗失败#r #r3,将根据连胜次数奖励比斗奖章。");
            Dimension d = richText.computeSize(151);
            richText.setSize(d);
            richText.setPreferredSize(d);
        }
        return richText;
    }

    public void setRichText(RichLabel richText) {
        this.richText = richText;
    }


    public JScrollPane getJscPanel1() {
        if (jscPanel1 == null) {
            // 属性滚动条
            jscPanel1 = new JScrollPane(getRichText1());
            jscPanel1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            jscPanel1.getVerticalScrollBar().setUI(new SrcollPanelUI());
            jscPanel1.getVerticalScrollBar().setUnitIncrement(20);
            jscPanel1.getViewport().setOpaque(false);
            jscPanel1.setOpaque(false);
            jscPanel1.setBounds(427, 61, 176, 189);
            jscPanel1.setBorder(BorderFactory.createEmptyBorder());
            jscPanel1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(jscPanel1);
        }

        return jscPanel1;


    }

    public void setJscPanel1(JScrollPane jscPanel1) {
        this.jscPanel1 = jscPanel1;
    }

    public RichLabel getRichText1() {
        if(richText1 == null){
            richText1 = new RichLabel();
            richText1.setText("试炼规则：#r1,累计挑战奖励机制#r2,原则可以无限挑战#r3,成功挑战后解锁新关卡#r4,挑战新关卡不消耗挑战次数#r5,每层的奖励唯一，可以选择性击杀");
            Dimension d = richText1.computeSize(151);
            richText1.setSize(d);
            richText1.setPreferredSize(d);
        }
        return richText1;
    }

    public void setRichText1(RichLabel richText1) {
        this.richText1 = richText1;
    }



    //新增加tcp
    @Override
    public void paint(Graphics g) {

        tcp.updateToTime(ImageMixDeal.userimg.getTime(), 0);
        tcp2.updateToTime(ImageMixDeal.userimg.getTime(), 0);
        tcp3.updateToTime(ImageMixDeal.userimg.getTime(), 0);
        tcp4.updateToTime(ImageMixDeal.userimg.getTime(), 0);
        super.paint(g);
        tcp.draw(g, 180, 310);
        tcp2.draw(g, 180+100, 310);
        tcp3.draw(g, 452, 310);
        tcp4.draw(g, 452+100, 310);
    }

}
